import React, {useEffect} from 'react';
import { Login, LoginParam} from '@/api/user'

import {Button, message} from "antd";
import {useNavigate} from "react-router-dom";
import {useSelector} from "react-redux";
import {IRootReducer} from "@/store";

const Home = () => {
    const navigate = useNavigate();

    const user = useSelector((state: IRootReducer) => {  //拿到store中的 user state
        return state.userReducer.user
    })

    const menu = useSelector((state: IRootReducer) => {  //拿到store中的 menu state
        return state.userReducer.menu
    })

    const onFinish = (values: LoginParam) => {
        message.loading('登陆中').then(() => {
            Login(values).then((res) => {
                if (res.status === 200) {
                    message.destroy()
                    message.success('欢迎回来')
                    // navigate('/') // 跳转到首页
                }
            })
        })
    }


    return (
        <div>
            Home Home Home
        </div>
    );
};

export default Home;
